home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / THIN C 2.0 / libs & .h files / Fonts.h < prev    next >
Text File  |  1996-01-05  |  7KB  |  273 lines

  1. /************************************************************
  2.  
  3. Created: Saturday, January 26, 1991 at 10:45 PM
  4.     Fonts.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1985-1990
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __FONTS__
  15. #define __FONTS__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21.  
  22. enum {
  23.  
  24.     systemFont = 0,
  25.     applFont = 1,
  26.     newYork = 2,
  27.     geneva = 3,
  28.     monaco = 4,
  29.     venice = 5,
  30.     london = 6,
  31.     athens = 7,
  32.     sanFran = 8,
  33.     toronto = 9,
  34.     cairo = 11,
  35.     losAngeles = 12,
  36.     times = 20,
  37.     helvetica = 21,
  38.     courier = 22,
  39.     symbol = 23,
  40.     mobile = 24,
  41.     commandMark = 17,
  42.     checkMark = 18,
  43.     diamondMark = 19
  44. };
  45. enum {
  46.     appleMark = 20,
  47.     propFont = 36864,
  48.     prpFntH = 36865,
  49.     prpFntW = 36866,
  50.     prpFntHW = 36867,
  51.     fixedFont = 45056,
  52.     fxdFntH = 45057,
  53.     fxdFntW = 45058,
  54.     fxdFntHW = 45059,
  55.     fontWid = 44208
  56. };
  57.  
  58. struct FMInput {
  59.     short family;
  60.     short size;
  61.     Style face;
  62.     Boolean needBits;
  63.     short device;
  64.     Point numer;
  65.     Point denom;
  66. };
  67.  
  68. typedef struct FMInput FMInput;
  69.  
  70. struct FMOutput {
  71.     short errNum;
  72.     Handle fontHandle;
  73.     unsigned char boldPixels;
  74.     unsigned char italicPixels;
  75.     unsigned char ulOffset;
  76.     unsigned char ulShadow;
  77.     unsigned char ulThick;
  78.     unsigned char shadowPixels;
  79.     char extra;
  80.     unsigned char ascent;
  81.     unsigned char descent;
  82.     unsigned char widMax;
  83.     char leading;
  84.     char unused;
  85.     Point numer;
  86.     Point denom;
  87. };
  88.  
  89. typedef struct FMOutput FMOutput;
  90. typedef FMOutput *FMOutPtr;
  91.  
  92. struct FontRec {
  93.     short fontType;         /*font type*/
  94.     short firstChar;        /*ASCII code of first character*/
  95.     short lastChar;         /*ASCII code of last character*/
  96.     short widMax;           /*maximum character width*/
  97.     short kernMax;          /*negative of maximum character kern*/
  98.     short nDescent;         /*negative of descent*/
  99.     short fRectWidth;       /*width of font rectangle*/
  100.     short fRectHeight;      /*height of font rectangle*/
  101.     short owTLoc;           /*offset to offset/width table*/
  102.     short ascent;           /*ascent*/
  103.     short descent;          /*descent*/
  104.     short leading;          /*leading*/
  105.     short rowWords;         /*row width of bit image / 2 */
  106. };
  107.  
  108. typedef struct FontRec FontRec;
  109.  
  110. struct FMetricRec {
  111.     Fixed ascent;           /*base line to top*/
  112.     Fixed descent;          /*base line to bottom*/
  113.     Fixed leading;          /*leading between lines*/
  114.     Fixed widMax;           /*maximum character width*/
  115.     Handle wTabHandle;      /*handle to font width table*/
  116. };
  117.  
  118. typedef struct FMetricRec FMetricRec;
  119.  
  120. struct WidEntry {
  121.     short widStyle;         /*style entry applies to*/
  122. };
  123.  
  124. typedef struct WidEntry WidEntry;
  125.  
  126. struct WidTable {
  127.     short numWidths;        /*number of entries - 1*/
  128. };
  129.  
  130. typedef struct WidTable WidTable;
  131.  
  132. struct AsscEntry {
  133.     short fontSize;
  134.     short fontStyle;
  135.     short fontID;           /*font resource ID*/
  136. };
  137.  
  138. typedef struct AsscEntry AsscEntry;
  139.  
  140. struct FontAssoc {
  141.     short numAssoc;         /*number of entries - 1*/
  142. };
  143.  
  144. typedef struct FontAssoc FontAssoc;
  145.  
  146. struct StyleTable {
  147.     short fontClass;
  148.     long offset;
  149.     long reserved;
  150.     char indexes[48];
  151. };
  152.  
  153. typedef struct StyleTable StyleTable;
  154.  
  155. struct NameTable {
  156.     short stringCount;
  157.     Str255 baseFontName;
  158. };
  159.  
  160. typedef struct NameTable NameTable;
  161.  
  162. struct KernPair {
  163.     char kernFirst;         /*1st character of kerned pair*/
  164.     char kernSecond;        /*2nd character of kerned pair*/
  165.     short kernWidth;        /*kerning in 1pt fixed format*/
  166. };
  167.  
  168. typedef struct KernPair KernPair;
  169.  
  170. struct KernEntry {
  171.     short kernLength;       /*length of this entry*/
  172.     short kernStyle;        /*style the entry applies to*/
  173. };
  174.  
  175. typedef struct KernEntry KernEntry;
  176.  
  177. struct KernTable {
  178.     short numKerns;         /*number of kerning entries*/
  179. };
  180.  
  181. typedef struct KernTable KernTable;
  182.  
  183. struct WidthTable {
  184.     Fixed tabData[256];     /*character widths*/
  185.     Handle tabFont;         /*font record used to build table*/
  186.     long sExtra;            /*space extra used for table*/
  187.     long style;             /*extra due to style*/
  188.     short fID;              /*font family ID*/
  189.     short fSize;            /*font size request*/
  190.     short face;             /*style (face) request*/
  191.     short device;           /*device requested*/
  192.     Point inNumer;          /*scale factors requested*/
  193.     Point inDenom;          /*scale factors requested*/
  194.     short aFID;             /*actual font family ID for table*/
  195.     Handle fHand;           /*family record used to build up table*/
  196.     Boolean usedFam;        /*used fixed point family widths*/
  197.     unsigned char aFace;    /*actual face produced*/
  198.     short vOutput;          /*vertical scale output value*/
  199.     short hOutput;          /*horizontal scale output value*/
  200.     short vFactor;          /*vertical scale output value*/
  201.     short hFactor;          /*horizontal scale output value*/
  202.     short aSize;            /*actual size of actual font used*/
  203.     short tabSize;          /*total size of table*/
  204. };
  205.  
  206. typedef struct WidthTable WidthTable;
  207.  
  208. struct FamRec {
  209.     short ffFlags;          /*flags for family*/
  210.     short ffFamID;          /*family ID number*/
  211.     short ffFirstChar;      /*ASCII code of 1st character*/
  212.     short ffLastChar;       /*ASCII code of last character*/
  213.     short ffAscent;         /*maximum ascent for 1pt font*/
  214.     short ffDescent;        /*maximum descent for 1pt font*/
  215.     short ffLeading;        /*maximum leading for 1pt font*/
  216.     short ffWidMax;         /*maximum widMax for 1pt font*/
  217.     long ffWTabOff;         /*offset to width table*/
  218.     long ffKernOff;         /*offset to kerning table*/
  219.     long ffStylOff;         /*offset to style mapping table*/
  220.     short ffProperty[9];    /*style property info*/
  221.     short ffIntl[2];        /*for international use*/
  222.     short ffVersion;        /*version number*/
  223. };
  224.  
  225. typedef struct FamRec FamRec;
  226.  
  227.  
  228. #ifdef __cplusplus
  229. extern "C" {
  230. #endif
  231. pascal void InitFonts(void)
  232.     = 0xA8FE; 
  233. pascal void GetFontName(short familyID,Str255 name)
  234.     = 0xA8FF; 
  235. pascal void GetFNum(ConstStr255Param name,short *familyID)
  236.     = 0xA900; 
  237. pascal Boolean RealFont(short fontNum,short size)
  238.     = 0xA902; 
  239. pascal void SetFontLock(Boolean lockFlag)
  240.     = 0xA903; 
  241. pascal FMOutPtr FMSwapFont(const FMInput *inRec)
  242.     = 0xA901; 
  243. pascal void SetFScaleDisable(Boolean fscaleDisable)
  244.     = 0xA834; 
  245. pascal void FontMetrics(const FMetricRec *theMetrics)
  246.     = 0xA835; 
  247. pascal void SetFractEnable(Boolean fractEnable); 
  248. pascal Boolean IsOutline(Point numer,Point denom)
  249.     = {0x7000,0xA854}; 
  250. pascal void SetOutlinePreferred(Boolean outlinePreferred)
  251.     = {0x7001,0xA854}; 
  252. pascal Boolean GetOutlinePreferred(void)
  253.     = {0x7009,0xA854}; 
  254. pascal OSErr OutlineMetrics(short byteCount,const void *textPtr,Point numer,
  255.     Point denom,short *yMax,short *yMin,FixedPtr awArray,FixedPtr lsbArray,
  256.     RectPtr boundsArray)
  257.     = {0x7008,0xA854}; 
  258. pascal void SetPreserveGlyph(Boolean preserveGlyph)
  259.     = {0x700A,0xA854}; 
  260. pascal Boolean GetPreserveGlyph(void)
  261.     = {0x700B,0xA854}; 
  262. pascal OSErr FlushFonts(void)
  263.     = {0x700C,0xA854}; 
  264. #if !defined(__SC__) || !defined(THINK_C)
  265. void getfnum(char *theName,short *familyID); 
  266. void getfontname(short familyID,char *theName); 
  267. #endif
  268. #ifdef __cplusplus
  269. }
  270. #endif
  271.  
  272. #endif
  273.